import type { VNode } from "vue";

export type SelectOptions = {
  label: string;
  value: string;
  disabled?: boolean;
};
export interface SelectProps {
  modelValue?: string | number;
  options?: SelectOptions[];
  placeholder?: string;
  disabled?: boolean;
  size?: "small" | "large";
  clearable?: boolean;
  renderLabel?: SelectLabelFun;
  //是否开启筛选
  filterable?: boolean;
  //自定义筛选
  filterMethod?:SelectFilter
  //是否发起网络请求
  remote?:boolean
  remoteMethod?:SelectRemote
}
export interface SelectStatus {
  inputValue?: string;
  selectedOption?: SelectOptions | null;
  isHoverOption?: boolean;
  loading?: boolean;
  //当前选中
  isHandleOption?: number;
}
export type SelectLabelFun = (option: SelectOptions) => VNode
export type SelectFilter = (value:string)=>SelectOptions[]
export type SelectRemote = (value:string)=>Promise<SelectOptions[]>
export interface SelectEmits {
  (e: "update:modelValue", value: string | number): void;
  (e: "change", value: string | number): void;
  //下拉列表是否展示
  (e: "visible-change", visible: boolean): void;
  //清除
  (e: "clear"): void;
}
